<template>
  <div class="app-container product-list">
    <div class="mdtop2">
      <temple-check   @getTemple="initTable"></temple-check>
    </div> 
    <div class="chartbox">
      <pie-chart :tableTitle="tableTitle" :axisData="axisData"></pie-chart> 
      <pie-chart :tableTitle="tableTitle2" :axisData="axisData2"></pie-chart>
    </div>
		<div style="hight:20px;"></div>
    <count-table :tableTitle="tableTitle" :axisData="axisData"></count-table>
    <count-table :tableTitle="tableTitle2" :axisData="axisData2" ></count-table> 
    

  </div> 
</template>
<script>
import templeCheck from "@/components/TempleCheck";
import countTable from "@/components/CountTable";
import pieChart from "@/components/PieChart";

import {  getBuddhistStatisticsFinish,  getBuddhistStatisticsMoney } from "../../api/buddha";

export default {
  name: "Buddhist",
  components: { templeCheck, countTable ,pieChart },
  data() {
    return {
      tableTitle: "寺院全年法会统计(单位：场)",
      axisData: [],
      tableTitle2: "全年法会收入统计(单位：元)",
      axisData2: []
    };
  },
  methods: {
    async initTable(templeId) {
      // console.log("initTable-templeId:", templeId);
      getBuddhistStatisticsFinish(templeId).then(finshResp => {
        if ( finshResp != null && finshResp.code == 0 &&  finshResp.data != null ) {
          this.axisData = finshResp.data.ritualPieList;
        }
      });
      // console.log('finshResp:',finshResp);
      getBuddhistStatisticsMoney(templeId).then(moneyResp => {
        if ( moneyResp != null &&  moneyResp.code == 0 &&  moneyResp.data != null  ) {
          this.axisData2 = moneyResp.data.ritualPieList;
        }
      });
      // console.log('moneyResp:',moneyResp);
    }
  },
  mounted() {
    this.initTable(0);
  }
};
</script>
<style>


</style>
